﻿namespace EFMLEditor.Internal
{
    using System.Collections.Generic;
    using System.Linq;

    public class ErrorContainer
    {
        private static readonly List<Error> Errors = new List<Error>();

        public static void Add(string section, string message)
        {
            Errors.Add(new Error {Message = message, Section = section});
        }
        public static Error[] GetErrors()
        {
            return Errors.ToArray();
        }
        public static Error[] GetErrors(string section)
        {
            return Errors.Where(error => error.Section == section).ToArray();
        }
        public static string[] GetSections()
        {
            var s = Errors.Select(error => error.Section).ToArray();
            return s;
        }
    }

    public class Error
    {
        public string Section;

        public string Message;
    }
}
